package com.rd.student.jike.class2.lihongming.Solution713;

import java.util.HashMap;
import java.util.Iterator;

/**
 * @Auther:Heinrich
 * @Date:2023/7/14-07-14-16:51
 * @Description:com.rd.student.jike.class2.lihongming.Solution713
 * @version:1.0
 */
public class Question7 {
    public static void main(String[] args) {
        HashMap AreaMap = new HashMap();
        String[] city = {"哈尔滨","大庆","绥化","齐齐哈尔","杭州","宁波","南昌","广州","福州","厦门"};
        String[] province = {"黑龙江","黑龙江","黑龙江","黑龙江","浙江","浙江","江西","广东","福建","福建"};
        for (int i = 0; i <city.length ; i++) {
            AreaMap.put(city[i],province[i]);
        }
        StringBuffer ProvinceStr = new StringBuffer();
        HashMap P_C_Num = new HashMap();
        //System.out.println(AreaMap);
        Iterator iterator = AreaMap.values().iterator();
        int count;
        while (iterator.hasNext()){
            String str = (String) iterator.next();
            if (!P_C_Num.containsKey(str)){
                count = 1;
                P_C_Num.put(str,count);
            }else{
                P_C_Num.put(str,(int)(P_C_Num.get(str))+1);
            }
        }
        Iterator iterator1 = P_C_Num.keySet().iterator();
        while (iterator1.hasNext()){
            String s = (String)(iterator1.next());
            ProvinceStr.append(s);
        }
        System.out.println(AreaMap);
        System.out.println("---------------------------");
        System.out.println(P_C_Num);
        System.out.println("---------------------------");
        System.out.println(ProvinceStr);

    }
}
